#ifndef NEWORDERWIDGET_H
#define NEWORDERWIDGET_H

#include <QWidget>
#include <QDialog>
#include <QLabel>
#include <QPushButton>
#include <QComboBox>
#include <QLineEdit>
#include <QLayout>
#include "barwidget.h"

class NewOrderDialog : public QDialog
{
    Q_OBJECT

public:
    NewOrderDialog(char *symbol, double price, time_t time, BarWidget *barWidget, QWidget *parent = 0);

protected slots:
    void setOrderType();
    void newOrder();
    void orderPriceChanged();
    void orderTakeProfitChanged();
    void orderStoplossChanged();

protected:
    void createWidgets();
    void createConnections();
    bool checkVaild();
    virtual void closeEvent(QCloseEvent *e);

private:
    double m_currPrice;
    double m_orderPrice;
    double m_orderLots;
    double m_orderStoploss;
    double m_orderTakeProfit;
    time_t m_time;
    char m_symbol[20];
    BarWidget *m_barWidget;
    QLabel *m_labelTakeProfit;
    QLabel *m_labelStoploss;
    QLabel *m_labelLots;
    QLabel *m_labelOrderPrice;
    QPushButton *m_btnOk;
    QPushButton *m_btnCancel;
    QComboBox *m_boxOrderType;
    QComboBox *m_boxLots;
    QLineEdit *m_editTakeProfit;
    QLineEdit *m_editStoploss;
    QLineEdit *m_editOrderPrice;

    QLayout *m_LimitLayout;
};

#endif // NEWORDERWIDGET_H